package cn.yeziji.forum.vo.chatroom;

import cn.yeziji.forum.entity.ForumChatroomEntity;
import cn.yeziji.forum.utils.TimeUtils;
import lombok.Data;

/**
 * 用户信息统计返回对象
 *
 * @author gzkemays
 * @since 2022/4/6 8:04
 */
@Data
public class UserMsgStatisticVO {
  String context;
  String from;
  String createTime;
  Integer noView;

  public static UserMsgStatisticVO buildByChatroomEntity(
      ForumChatroomEntity entity, Integer count) {
    UserMsgStatisticVO statisticVO = new UserMsgStatisticVO();
    statisticVO.setContext(entity.getContext());
    statisticVO.setFrom(entity.getFrom());
    statisticVO.setCreateTime(TimeUtils.COMMON_SDF.format(entity.getCreateTime()));
    statisticVO.setNoView(count);
    return statisticVO;
  }
}
